package com.lxy.fun;

import java.util.Locale;
import java.util.function.Consumer;

@FunctionalInterface
public interface Fun {
    abstract void run(String str);
}

class Testfun{
    public static void main(String[] args) {
//        Fun fun = new Fun() {
//            @Override
//            public void run(String str) {
//                System.out.println("我是你爹" + str);
//            }
//        };
//        fun.run("刘翔宇");

        Fun fun = str -> System.out.println("我是你爹" + str);
        fun.run("刘翔宇");

        run("我是你爹", new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        });
        run("我是你爹",s -> System.out.println(s));
        run("我是你爹", System.out::println);
        run("我是你爹",s -> System.out.println(s.length()));
        run("abcd",s -> System.out.println(s.toUpperCase()));
    }

    //消费型接口
    public static void run(String str, Consumer<String> consumer){
        consumer.accept(str);
    }
}